package com.itheima.moviedemo;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * 测试类
 */
public class Test {
    public static void main(String[] args) {
        //创建一个集合存储这些电影
        ArrayList<Movie> movies = new ArrayList<>();
//        movies.add(new Movie(1,"水门桥", 38.9, 9.8, "徐克", "吴京","12万人想看"));
//        movies.add(new Movie(2, "出拳吧", 39, 7.8, "唐晓白", "田雨","3.5万人想看"));
//        movies.add(new Movie(3,"月球陨落", 42, 7.9, "罗兰", "贝瑞","17.9万人想看"));
//        movies.add(new Movie(4,"一点就到家", 35, 8.7, "许宏宇", "刘昊然","10.8万人想看"));

        Scanner sc = new Scanner(System.in);
        MovieSystem movieSystem = new MovieSystem(movies);
        //用whiletrue循环，让用户可以重复操作
        while (true) {
            System.out.println("----------电影管理系统----------");
            System.out.println("1.添加电影");
            System.out.println("2.查询电影(通过编号)");
            System.out.println("3.删除电影(通过主演)");
            System.out.println("4.退出系统");
            System.out.println("请输入您的选择：");
            int command = sc.nextInt();
            switch (command) {
                case 1:
                    movieSystem.addMovie();
                    break;
                case 2:
                    System.out.println("请输入编号：");
                    String Id = sc.next();
                    movieSystem.getMovieById(Id);
                    break;
                case 3:
                    System.out.println("请输入主演：");
                    String Actor = sc.next();
                    movieSystem.removeMovieByActor(Actor);
                    break;
                case 4:
                    System.out.println("谢谢使用！");
                    System.exit(0);
                    break;
                    default:
                        System.out.println("输入有误！请重新输入！");
            }


        }
    }
}
